// MouseState.cs
//

using System;
using System.Collections.Generic;
using Moonbeam.Core;

namespace Moonbeam.Input
{
    public class MouseState
    {
        #region Properties       

        #endregion

        #region Fields

        List<int> _buttons = new List<int>(2);
        Vector2 _position;

        #endregion

        public MouseState()
        {
            _position = new Vector2(0, 0);
        }

        #region public methods

        public bool IsButtonDown(Buttons button)
        {
            return _buttons.Contains((int)button);
        }

        public bool IsButtonUp(Buttons button)
        {
            return !_buttons.Contains((int)button);
        }

        public Buttons[] GetPressedKeys()
        {
            List<Buttons> retVal = new List<Buttons>();

            foreach (int currentButton in _buttons)
            {
                retVal.Add((Buttons)currentButton);
            }

            return (Buttons[])retVal;
        }

        public Vector2 GetPosition()
        {
            return _position;
        }

        #endregion

        #region internal methods

        internal void _SetMousePosition(Vector2 position)
        {
            _position = position;
        }

        internal void _SetButtons(List<int> buttonsPressed)
        {
            _buttons.Clear();
            _buttons = buttonsPressed;
        }

        #endregion
    }
}
